package org.geeks.gsspringsecurity.biz.repository;

import org.geeks.gsspringsecurity.base.repository.BaseRepository;
import org.geeks.gsspringsecurity.biz.domain.User;
import org.springframework.data.jpa.repository.Query;

/**
 * 用户Repository
 * 
 * @author Geek-S
 *
 */
public interface UserRepository extends BaseRepository<User> {

	/**
	 * 根据用户名查询用户
	 * 
	 * @param username
	 *            用户名
	 * @return 用户
	 */
	@Query("select user from User user join fetch user.roles roles join fetch roles.authorities where user.username = ?1")
	User findByUsername(String username);

}
